package com.hq.ims.data.service;

import com.hq.ims.data.dao.SerialNumberMapper;
import com.hq.ims.data.entity.SerialNumber;
import com.hq.mybatis.base.BaseService;
import com.hq.web.inf.serial.ISerialNumberOperationService;
import org.springframework.stereotype.Service;

/**
 * jiang bai ping
 *
 * @Email 526666031@qq.com
 * @Detail 编号表|implements:com.hq.core.utils.bean.ISerialNumber服务实现类
 */
@Service
public class BaseSerialNumberService extends BaseService<SerialNumberMapper, SerialNumber> implements ISerialNumberOperationService {

    @Override
    public void upwardUpdate(String serialNumberId) {
        SerialNumber serialNumber = this.lambdaQuery().select(SerialNumber::getSnLen).eq(SerialNumber::getId, serialNumberId).one();
        this.lambdaUpdate()
                .eq(SerialNumber::getId, serialNumberId)
                .set(SerialNumber::getCurrentSn, serialNumber.getCurrentSn() + 1)
                .update();
    }
}
